function CicBase(config){
	//成功操作
    this.okdialog=function(msg){
     if(!msg)msg='操作成功!'
   	 $.ligerDialog.success(msg);
    }
    //失败操作
    this.nodialog=function(msg){
     if(!msg)msg='操作失败!'
   	 $.ligerDialog.error(msg);
    }
    this.alert=function(msg){
    	$.ligerDialog.question(msg);
    }
    this.listLoad=function(){
    	if(this.list){
    		this.list.loadData();
    	}
    }
    this.closeDialog=function(){
    	if(this.win){
    		this.win.close();
    	}
    }
    this.open=function(config){
    	var con=$.extend({showToggle: true, showMax: true, showToggle: true, showMin: true, isResize: true, slide: false},config);
    	return $.ligerDialog.open(con);
    }
    this.loadData=function (jsonStr){
    	var obj = jsonStr;
    	if(typeof jsonStr =='string'){
    		obj = jQuery.parseJSON(jsonStr);
    	}
        var key,value,tagName,type,arr;
        for(x in obj){
            key = x;
            value = obj[x];
            var inputs=$("input[name='"+key+"']");
            $.each(inputs,function(){
                tagName = $(this)[0].tagName.toUpperCase();
                type = $(this).attr('type').toLowerCase();
                if(tagName=='INPUT'){
                    if(type=='radio'){
                    	if($(this).val()==value){
                    		$(this).attr('checked',"checked");
                    	}else{
                    		$(this).removeAttr('checked');
                    	}
                    }else if(type=='checkbox'){
                        arr = value.split(',');
                        for(var i =0;i<arr.length;i++){
                            if($(this).val()==arr[i]){
                                $(this).attr('checked',true);
                                break;
                            }
                        }
                    }else{
                        $(this).val(value);
                    }
                }else if(tagName=='SELECT' || tagName=='TEXTAREA'){
                    $(this).val(value);
                }
                 
            });
        }
    }
    this.cicValidate=function(formid,config){
    	var con=$.extend({
            debug: true,
            errorPlacement: function (lable, element)
            {
            	if (element.hasClass("l-textarea")) {
                    element.addClass("l-textarea-invalid");
                }
                else if (element.hasClass("l-text-field")) {
                    element.parent().addClass("l-text-invalid");
                }

                var nextCell = element.parents("td:first").next("td");
                nextCell.find("div.l-exclamation").remove(); 
                $('<div class="l-exclamation" title="' + lable.html() + '"></div>').appendTo(nextCell).ligerTip(); 

            },
            success: function (lable)
            {
            	var element = $("#" + lable.attr("for"));
                var nextCell = element.parents("td:first").next("td");
                if (element.hasClass("l-textarea")) {
                    element.removeClass("l-textarea-invalid");
                }
                else if (element.hasClass("l-text-field")) {
                    element.parent().removeClass("l-text-invalid");
                }
                nextCell.find("div.l-exclamation").remove();
            },
            submitHandler: function ()
            {
                $("form .l-text,.l-textarea").ligerHideTip();
                config.audit();
            }
        },config);
    	var v = $(formid).validate(con);
    	return v;
    }
}